<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%@ page language="java" import="java.util.*" import="java.sql.*" pageEncoding="utf-8"%>
<html>
<head>
<title>页面</title>
<style type="text/css">
/*top*/
body{margin:0 auto;padding:0 auto;text-align: center;width:980px;}

span{font-size:13px;}

table{border:1px dashed white;background: white;}

.content{float: right;top: -180px;position: relative;}

.info{margin-left: 800px;position: relative;top:-250px;}

.div_content table{border:1px solid white;background: white;}/*/////////////////////////////////////////////////////*/

td{border: 1px dashed gray;}

ul, li { list-style:none;}

a{ color:#333; text-decoration:none;}

a:hover{ color:#F00; text-decoration:underline;}

a:active{ color:#30F;}

.nav {margin-top: -10px;margin-left: 50px;}/*////////////////////////////////////////////////*/

.jieshao{float: left;position: relative;left: 200px;}

.nav ul li { float:left;}

.nav ul li a { width:120px; height:40px; text-align:center; line-height:40px; display:block; border-right:2px solid #ccc; background:#eee; color:#666;}

.nav ul li a:hover{ color:#f00;background: #000000;}

.nav ul li ul { position:absolute; display:none;}

.nav ul li ul li { float:none;}

.nav ul li ul li a { border-right:none; border-top:1px dotted #ccc; background:#f5f5f5;}

.nav ul li:hover ul{ display:block; }

.top{margin: 5px auto 0px auto;padding: 0px;width:980px;height:78px;text-align: left;}

.logo{margin-right: 900px;}

.banner{width: 307px;height: 61px;float:left;margin-top: -10px;}

.options{float: right;margin: -20px;}

.home,.shu,.fav{float: leftmargin: 0 16px;padding:0 0 auto auto;display: inline;padding: 0px 0px;margin-right: 20px;}

.home a,.shu a,.fav a{color: #9b9b9b;float: left;margin-left: 15px;margin-top: -10px;}
/*top*/
.content{margin: 80px 0px ; }

h1{ background:black; font-size:14px; height:35px; line-height:35px; padding-right:900px; color:white;margin-top: 80px;}

.zhuangtai{position: relative;left: 200px; font-size: 13px; color:red;}

.zhuangtai1{position: relative;left: 200px; font-size: 13px; color:gray;}

#Methods1{ width:900px;height:110px;}

#Methods1 dl{margin:0px 10px 0 10px; float:left;border: none;}

#Methods1 dt{width:65px; margin:10px; height:50px; background:#FFF;}

#Methods1 dd{width:65px; margin:0 0 10px 10px; height:30px; line-height:30px; background:#FFFFFF; text-align:center;}

.td1{margin-top: 0px;}

.td2{margin-top: 0px;}

.td3{margin-top: 0px;}

.td4{margin-top: 0px;}

.td1 .td1_content{float: left;}

.tips{margin-top: 0px;margin-right: 170px;}

.tips span{color:gray;font-size: 13px;}

.tips ul{margin-right: 50px;}

hr{border:1px dashed gray;width:980px;}

.friend{width:980;height:300px;}
/*nav*/
</style>
</head>
  <body>
   <%@ include file="dengluPublic.jsp" %>
 <%@ include file="daohangPublic.jsp"%>
      
 <%!String friend; 
	String cname;
	String fno;
	int max;
	%>
	 <%
	   request.setCharacterEncoding("utf-8");
	   String cno=request.getParameter("cno");	
	   System.out.println(cno);	    
	    %>
	     <% 
		String driverClass3="com.mysql.jdbc.Driver";
	    String url3="jdbc:mysql://localhost:3306/vote?useSSL=false";
	    String user3="root";
	    String password3="womenilu2580";	 	    
	    Class.forName(driverClass3);
	    Connection conn3=DriverManager.getConnection(url3,user3,password3);
	    Statement stat3=conn3.createStatement();	 
	    String sql3="select friend.cname as cname from friend,t_customer where t_customer.cno=friend.cno and t_customer.cno="+cno+"";//通过其他页面传过来的cno值查询朋友的名字
	    ResultSet rs3=stat3.executeQuery(sql3);
	    while(rs3.next()){  
	    cname=rs3.getString("cname");  
	    }  
	    %>
	    <h1><font><%=cname %>的主页</font></h1>
<div id="Methods1">	
<table width="980px;" cellspacing="0px" border="0px">
<tr><td><div class="freind">
<font style="position: relative;right: 400px;"><b><%=cname %>的好友：</b></font><br />	  
	  
	    <% 
		String driverClass="com.mysql.jdbc.Driver";
	    String url="jdbc:mysql://localhost:3306/vote?useSSL=false";
	    String user="root";
	    String password="womenilu2580";
	    Class.forName(driverClass);
	    Connection conn=DriverManager.getConnection(url,user,password);
	    Statement stat=conn.createStatement();	 
	    String sql="select fno as fno,friend.cname as cname,friend from friend,t_customer where t_customer.cno=friend.cno and t_customer.cno="+cno+"";//通过cno传过来的值查询朋友的朋友
	    ResultSet rs=stat.executeQuery(sql);	    	    
	    while(rs.next()){
	    friend=rs.getString("friend");	     
	    cname=rs.getString("cname");  
	    fno=rs.getString("fno");  
	    %>
	    	  	<dl>
				    	<dt><a href="customerPageReciever.jsp?cno=<%=fno%>"><img src="img/logo.jpg" width="50px" height="50px" /></a></dt>
				    	<dd><%=friend %>
				    	<%if(cname.equals(customer.getCname())){//在自己的主页才可以删除朋友 %>
				    	<a href="deletePerson.jsp?cno=<%=fno%>">x</a>
				    	<%
				    	}else{//在其他用户的主页
				    	if(!friend.equals(customer.getCname()))//判断其他用户的朋友里有没有当前登陆用户，即不能自己加自己
				    	{
				    	 %>
				    	 <a href="addFriend1.jsp?cno=<%=fno%>">+</a>
				    	 <%
				    	 }else{}
				    	 } %>
				    	  
				    	</dd>				    	
				</dl>								 	
	 		<%
		    	}
		    	%>
</div></td></tr>
<tr><td><div class="freind">
<font style="position: relative;right:400px;"><b><%=cname %>的文章：</b></font><br />
	
	 <%!String friend1; 
		String message1;
		String time1;
		String id;
		String message;%>	  
		   <%
		   request.setCharacterEncoding("utf-8");		   		   		  
		    %>
		    <% 
			String driverClass1="com.mysql.jdbc.Driver";
		    String url1="jdbc:mysql://localhost:3306/vote?useSSL=false";
		    String user1="root";
		    String password1="womenilu2580";
		    Class.forName(driverClass1);
		    Connection conn1=DriverManager.getConnection(url1,user1,password1);
		    Statement stat1=conn1.createStatement();	 
		    String sql1="select id,cname,message,time from science,t_customer where t_customer.cname=science.publisher and cname='"+cname+"'order by time";
		    ResultSet rs1=stat1.executeQuery(sql1);
		    while(rs1.next()){	    	 
		    message1=rs1.getString("message");			    	    
		    time1=rs1.getString("time");
		    id=rs1.getString("id");		    
		    %>		    	  	    
				 <font style="position: relative;right: 340px;"><a href="scienceNews.jsp?id=<%=id%>"><%=message1 %></a>---<%=time1 %>	<br/></font>									 	
		 		<%
			    	}
			    	%>		    	
</div></td></tr>
<tr><td><div class="freind"><font style="position: relative;right:400px;"><b><%=cname %>的评论：</b></font><br />
 <%! String message2;
 String message7;
 	String xinxi2;
 	String id2;
 	String id3;
 	String id7;
 	String count;
 	String jtime;
 	String jname;
 	String cno7;
		     %>	  
		   <%
		   request.setCharacterEncoding("utf-8");		   	   
		    %>
		    <% 
			String driverClass2="com.mysql.jdbc.Driver";
		    String url2="jdbc:mysql://localhost:3306/vote?useSSL=false";
		    String user2="root";
		    String password2="womenilu2580";
		    Class.forName(driverClass2);
		    Connection conn2=DriverManager.getConnection(url2,user2,password2);
		    Statement stat2=conn2.createStatement();	 
		    String sql2="select id,science.message,xinxi from science,comment,t_customer where comment.message=science.message and t_customer.cname=comment.cname and t_customer.cname='"+cname+"'";
		    ResultSet rs2=stat.executeQuery(sql2);
		    while(rs2.next()){	    	 
		    message2=rs2.getString("message");
		    xinxi2=rs2.getString("xinxi"); 
		    id2=rs2.getString("id");   				       
		    %>		    	  	    
				 <font style="position: relative;right: 340px;"><a href="scienceNews.jsp?id=<%=id2%>"><%=message2 %></a>---<%=xinxi2 %>	<br/></font>									 	
		 		<%
			    	}
			    	%>		    	
</div></td></tr>
<% 
			String driverClass4="com.mysql.jdbc.Driver";
		    String url4="jdbc:mysql://localhost:3306/vote?useSSL=false";
		    String user4="root";
		    String password4="womenilu2580";
		    Class.forName(driverClass4);
		    Connection conn4=DriverManager.getConnection(url4,user4,password4);
		    Statement stat4=conn4.createStatement();	 
		    String sql4="select count(*) as count from science where jname='"+cname+"'";
		    ResultSet rs4=stat.executeQuery(sql4);
		    while(rs4.next()){	    	 
		    count=rs4.getString("count");
		    }%>
<tr><td><div class="freind"><font style="position: relative;right:400px;"><b><%=cname %>在借的作品( <%=count%>)</b></font><br />		  
		    <% 
			
		    Class.forName(driverClass4);
		    Connection conn5=DriverManager.getConnection(url4,user4,password4);
		    Statement stat5=conn5.createStatement();	 
		    String sql5="select message,id,jtime from science where jname='"+cname+"' and zhuangtai='借出' order by jtime";
		    ResultSet rs5=stat5.executeQuery(sql5);		    
		    while(rs5.next()){	    	 
		    message=rs5.getString("message");
		    jtime=rs5.getString("jtime");
		    id3=rs5.getString("id");		    
		    		    		       		   
		    %>		    	  	    
				<font style="position: relative;right: 340px;"><a href="scienceNews.jsp?id=<%=id3%>"><%=message %></a>---<%=jtime %>
				<%if(cname.equals(customer.getCname())) {%>
				<a href="zhuangtaiZhuanbian.jsp?id=<%=id3%>">归还</a>
				<%
				}
				 %>
				<br/></font>									 	
		 		<%
			    	}
			    	%>		    	
</div></td></tr>
<tr><td><div class="freind"><font style="position: relative;right:400px;"><b><%=cname %>借出的作品</b></font><br />		  
		    <% 
			
		    Class.forName(driverClass4);
		    Connection conn7=DriverManager.getConnection(url4,user4,password4);
		    Statement stat7=conn7.createStatement();	 
		    String sql7="select jname,message,id,t_customer.cno from science,t_customer where t_customer.cname=science.jname and publisher='"+cname+"'and zhuangtai='借出'  order by jtime";
		    ResultSet rs7=stat7.executeQuery(sql7);		    
		    while(rs7.next()){	    	 
		    jname=rs7.getString("jname");	
			message7=rs7.getString("message");		    	    	    
		    cno7=rs7.getString("cno");   
		    		       		   
		    %>		    	  	    
				<font style="position: relative;right: 340px;"><a href="scienceNews.jsp?id=<%=id7%>"><%=message7 %></a>---<a href="customerPage.jsp?cno=<%=cno7%>"><%=jname %></a>	<br/></font>									 	
		 		<%
			    	}
			    	%>		    	
</div></td></tr>
</table>	
<%@ include file="endPublic.jsp" %>
</div>
  </body>
</html>
